package com.example.myapplication.demo;

import javax.inject.Singleton;

import dagger.Component;

/**
 * Created by ly on 2016/10/10 11:03.
 */
@Component(modules = {MainModule.class})  // TODO: 2016/10/10 注意
@Singleton // TODO: 2016/10/10 注意
public abstract class MainComponent {
    private static MainComponent component;

    abstract void inject(MainActivity mainActivity);

    public static MainComponent getInstance() {
        if (component == null) {
            component = DaggerMainComponent.builder().build();
        }
        return component;
    }
}
